<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" dir="ltr">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>【转载】音频视频转化工具JAVE（ffmpeg的Java封装） - suflow - ITeye技术网站</title>
    <meta name="description" content="     转自：http://tj007-bo.iteye.com/blog/435740     JAVE (Java Audio Video Encoder) 类库是一个 ffmpeg 项目的 Java 语言封装。开发人员可以使用JAVE 在不同的格式间转换视频和音频。例如将 AVI 转成 MPEG 动画，等等 ffmpeg 中可以完成的在 JAVE 都有对应的方法。     Examples  ..." />
    <meta name="keywords" content="java, 音频, 视频, ffmpeg, jave 【转载】音频视频转化工具JAVE（ffmpeg的Java封装）" />
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
    <link rel="search" type="application/opensearchdescription+xml" href="/open_search.xml" title="ITeye" />
    <link href="/rss" rel="alternate" title="suflow" type="application/rss+xml" />
    <link href="http://www.iteye.com/stylesheets/blog.css?1355131335" media="screen" rel="stylesheet" type="text/css" />
<link href="http://www.iteye.com/stylesheets/themes/blog/blue.css?1326191326" media="screen" rel="stylesheet" type="text/css" />
    <script src="http://www.iteye.com/javascripts/application.js?1338174647" type="text/javascript"></script>
    <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-535605-1']);
  _gaq.push(['_setDomainName', 'iteye.com']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>


      <link href="http://www.iteye.com/javascripts/syntaxhighlighter/SyntaxHighlighter.css?1348819953" media="screen" rel="stylesheet" type="text/css" />
  <script src="http://www.iteye.com/javascripts/syntaxhighlighter/shCoreCommon.js?1325907333" type="text/javascript"></script>
<script src="http://www.iteye.com/javascripts/hotkey.js?1324994303" type="text/javascript"></script>
  <script src="http://www.iteye.com/javascripts/code_favorites.js?1325907333" type="text/javascript"></script>
<script src="http://www.iteye.com/javascripts/weiboshare.js?1324994303" type="text/javascript"></script>
  </head>
  <body>
    <div id="header">
      <div id="blog_site_nav">
  <a href="http://www.iteye.com/" class="homepage">首页</a>
  <a href="http://www.iteye.com/news">资讯</a>
  <a href="http://www.iteye.com/magazines">精华</a>
  <a href="http://www.iteye.com/forums">论坛</a>
  <a href="http://www.iteye.com/ask">问答</a>
  <a href="http://www.iteye.com/blogs">博客</a>
  <a href="http://www.iteye.com/blogs/subjects">专栏</a>
  <a href="http://www.iteye.com/groups">群组</a>
  <a href="#" onclick="return false;" id="msna"><u>更多</u> <small>▼</small></a>
  <div class="quick_menu" style="display:none;">
    <a target="_blank" href="http://job.iteye.com/iteye">招聘</a>
    <a href="http://www.iteye.com/search">搜索</a>
  </div>
</div>

      <div id="user_nav">
      <a href="/login" class="welcome" title="登录">您还未登录 !</a>
    <a href="/login">登录</a>
    <a href="/signup" class="nobg">注册</a>
  </div>

    </div>

    <div id="page">
      <div id="branding" class="clearfix">
        <div id="blog_name">
          <h1><a href="/">suflow</a></h1>
        </div>
        <div id='fd'></div>
        <div id="blog_navbar">
          <ul>
            <li class='blog_navbar_for'><a href="http://suflow.iteye.com"><strong>博客</strong></a></li>
            <li ><a href="/weibo">微博</a></li>
            <li ><a href="/album">相册</a></li>
            <li ><a href="/link">收藏</a></li>
            <li ><a href="/blog/guest_book">留言</a></li>
            <li ><a href="/blog/profile">关于我</a></li>
          </ul>
    
          <div class="search">
            <form action="/blog/search" method="get">
              <input class="search_text" id="query" name="query" style="margin-left: 10px;width: 110px;" type="text" value="" />
              <input class="submit_search" type="submit" value="" />
            </form>
          </div> 
          <div id="fd"></div>         
        </div>
      </div>
      
      <div id="content" class="clearfix">
        <div id="main">
          



          


<div class="blog_main">
  <div class="blog_title">
    <h3>
      <a href="/blog/1742838">【转载】音频视频转化工具JAVE（ffmpeg的Java封装）</a>
      <em class="actions">      </em>
    </h3>
    <ul class='blog_categories'><strong>博客分类：</strong> <li><a href="/category/94922">Java</a></li> </ul>
        <div class='news_tag'><a href="http://www.iteye.com/blogs/tag/java">java</a><a href="http://www.iteye.com/blogs/tag/%E9%9F%B3%E9%A2%91">音频</a><a href="http://www.iteye.com/blogs/tag/%E8%A7%86%E9%A2%91">视频</a><a href="http://www.iteye.com/blogs/tag/ffmpeg">ffmpeg</a><a href="http://www.iteye.com/blogs/tag/jave">jave</a>&nbsp;</div>
  </div>

  <div id="blog_content" class="blog_content">
    <p> </p>
<dd style="font-size: 14px; line-height: 25.200000762939453px;" class="ArticleContent">
<p style="padding: 0px;">转自：<a href="http://tj007-bo.iteye.com/blog/435740">http://tj007-bo.iteye.com/blog/435740</a></p>
<p style="padding: 0px;"> </p>
<p style="padding: 0px;">JAVE (Java Audio Video Encoder) 类库是一个 <a href="http://www.oschina.net/p/ffmpeg" style="color: #108ac6;">ffmpeg</a> 项目的 Java 语言封装。开发人员可以使用JAVE 在不同的格式间转换视频和音频。例如将 AVI 转成 MPEG 动画，等等 ffmpeg 中可以完成的在 JAVE 都有对应的方法。</p>
<p style="padding: 0px;"> </p>
<h1 style="line-height: 1.5em; margin: 0px 0px 0.5em; padding: 0px;">Examples</h1>
<p style="padding: 0px;"><strong>From a generic AVI to a youtube-like FLV movie, with an embedded MP3 audio stream:</strong></p>
<pre>File source = new File("source.avi");
File target = new File("target.flv");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Integer(64000));
audio.setChannels(new Integer(1));
audio.setSamplingRate(new Integer(22050));
VideoAttributes video = new VideoAttributes();
video.setCodec("flv");
video.setBitRate(new Integer(160000));
video.setFrameRate(new Integer(15));
video.setSize(new VideoSize(400, 300));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("flv");
attrs.setAudioAttributes(audio);
attrs.setVideoAttributes(video);
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);</pre>
<p style="padding: 0px;"><strong>Next lines extracts audio informations from an AVI and store them in a plain WAV file:</strong></p>
<pre>File source = new File("source.avi");
File target = new File("target.wav");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("pcm_s16le");
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("wav");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);</pre>
<p style="padding: 0px;"><strong>Next example takes an audio WAV file and generates a 128 kbit/s, stereo, 44100 Hz MP3 file:</strong></p>
<pre>File source = new File("source.wav");
File target = new File("target.mp3");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Integer(128000));
audio.setChannels(new Integer(2));
audio.setSamplingRate(new Integer(44100));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mp3");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);</pre>
<p style="padding: 0px;"><strong>Next one decodes a generic AVI file and creates another one with the same video stream of the source and a re-encoded low quality MP3 audio stream:</strong></p>
<pre>File source = new File("source.avi");
File target = new File("target.avi");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Integer(56000));
audio.setChannels(new Integer(1));
audio.setSamplingRate(new Integer(22050));
VideoAttributes video = new VideoAttributes();
video.setCodec(VideoAttributes.DIRECT_STREAM_COPY);
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("avi");
attrs.setAudioAttributes(audio);
attrs.setVideoAttributes(video);
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);</pre>
<p style="padding: 0px;"><strong>Next one generates an AVI with MPEG 4/DivX video and OGG Vorbis audio:</strong></p>
<pre>File source = new File("source.avi");
File target = new File("target.avi");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libvorbis");
VideoAttributes video = new VideoAttributes();
video.setCodec("mpeg4");
video.setTag("DIVX");
video.setBitRate(new Integer(160000));
video.setFrameRate(new Integer(30));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mpegvideo");
attrs.setAudioAttributes(audio);
attrs.setVideoAttributes(video);
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);</pre>
<p style="padding: 0px;"><strong>A smartphone suitable video:</strong></p>
<pre>File source = new File("source.avi");
File target = new File("target.3gp");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libfaac");
audio.setBitRate(new Integer(128000));
audio.setSamplingRate(new Integer(44100));
audio.setChannels(new Integer(2));
VideoAttributes video = new VideoAttributes();
video.setCodec("mpeg4");
video.setBitRate(new Integer(160000));
video.setFrameRate(new Integer(15));
video.setSize(new VideoSize(176, 144));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("3gp");
attrs.setAudioAttributes(audio);
attrs.setVideoAttributes(video);
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);</pre>
</dd>
<dd style="font-size: 14px; line-height: 25.200000762939453px;" class="ArticleContent">
<ul style="margin: 0px 0px 1.5em; padding: 0px;">
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">项目主页： <a href="http://www.sauronsoftware.it/projects/jave/" style="color: #108ac6;" target="_blank">http://www.sauronsoftware.it/projects/jave/</a>
</li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">文档地址： <a href="http://www.sauronsoftware.it/projects/jave/manual.php" style="color: #108ac6;" target="_blank">http://www.sauronsoftware.it/projects/jave/manual.php</a>
</li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">下载地址： <a href="http://www.sauronsoftware.it/projects/jave/download.php" style="color: #108ac6;" target="_blank">http://www.sauronsoftware.it/projects/jave/download.php</a>
</li>
</ul>
</dd>
<dd style="font-size: 14px; line-height: 25.200000762939453px;" class="ArticleContent"><br></dd>
<dd style="font-size: 14px; line-height: 25.200000762939453px;" class="ArticleContent"><br></dd>
  </div>

  


  <IFRAME SRC="/iframe_ggbd/794" SCROLLING=no WIDTH=468 HEIGHT=60 FRAMEBORDER=0></IFRAME>
  
  <div id="bottoms" class="clearfix">
    
    <div id="share_weibo">分享到：
      <a data-type='sina' href="javascript:;" title="分享到新浪微博"><img src="/images/sina.jpg"></a>
      <a data-type='qq' href="javascript:;" title="分享到腾讯微博"><img src="/images/tec.jpg"></a>
    </div>
  </div>

  <div class="blog_nav">
    <div class="pre_next">
      
      
      <a href="/blog/1695661" class="pre" title="【转载】二维码（QRCODE）数据格式">【转载】二维码（QRCODE）数据格式</a>
    </div>
  </div>
  <div class="blog_bottom">
    <ul>
      <li>2012-12-06 13:13</li>
      <li>浏览 35</li>
      <li><a href="#comments">评论(0)</a></li>
      
      
      <li>分类:<a href="http://www.iteye.com/blogs/category/opensource">开源软件</a></li>      
      <li class='last'><a href="http://www.iteye.com/wiki/blog/1742838" target="_blank" class="more">相关推荐</a></li>
    </ul>
  </div>

  <div class="blog_comment">
    <h5>评论</h5>
    <a id="comments" name="comments"></a>
    
    
    
  </div>

  <div class="blog_comment">
    <h5>发表评论</h5>
            <p style="text-align:center; margin-top:30px;margin-bottom:0px;"><a href="/login" style="background-color:white;"> <img src="/images/login_icon.png" style="vertical-align:middle; margin-right: 10px;" /></a><a href="/login">  您还没有登录,请您登录后再发表评论 </a></p>
      </div>
</div>


<script type="text/javascript">
  dp.SyntaxHighlighter.HighlightAll('code', true, true);

  $$('#main .blog_content pre[name=code]').each(function(pre, index){ // blog content
    var post_id = 1742838;
    var location = window.location;
    source_url = location.protocol + "//" + location.host + location.pathname + location.search;
    pre.writeAttribute('codeable_id', post_id);
    pre.writeAttribute('codeable_type', "Blog");
    pre.writeAttribute('source_url', source_url);
    pre.writeAttribute('pre_index', index);
    pre.writeAttribute('title', '【转载】音频视频转化工具JAVE（ffmpeg的Java封装）');
  });
  $$('#main .blog_comment > div').each(function(comment){// comment
    var post_id = comment.id.substr(2);
    $$("#"+comment.id+" pre[name=code]").each(function(pre, index){
      var location = window.location;
      source_url = location.protocol + "//" + location.host + location.pathname + location.search;
      source_url += "#" + comment.id;
      pre.writeAttribute('codeable_id', post_id);
      pre.writeAttribute('codeable_type', "BlogComment");
      pre.writeAttribute('source_url', source_url);
      pre.writeAttribute('pre_index', index);
      pre.writeAttribute('title', '【转载】音频视频转化工具JAVE（ffmpeg的Java封装）');
    });
  });
  code_favorites_init();

  fix_image_size($$('div.blog_content img'), 700);
  function quote_comment(id) {
    new Ajax.Request('/editor/quote', {
      parameters: {'id':id, 'type':'BlogComment'},
      onSuccess:function(response){editor.bbcode_editor.textarea.insertAfterSelection(response.responseText);
        Element.scrollTo(editor.bbcode_editor.textarea.element);}
    });
  }

  new WeiboShare({share_buttons: $('share_weibo'), img_scope: $('blog_content')});
</script>




        </div>

        <div id="local">
          <div class="local_top"></div>
          <div id="blog_owner">
  <div id="blog_owner_logo"><a href='http://suflow.iteye.com'><img alt="suflow的博客" class="logo" src="http://www.iteye.com/images/user-logo.gif?1324994303" title="suflow的博客: suflow" /></a></div>
  <div id="blog_owner_name">suflow</div>
</div>

          <div id="blog_actions">
            <ul>
              <li>浏览: 14533 次</li>
              <li>性别: <img alt="Icon_minigender_1" src="http://www.iteye.com/images/icon_minigender_1.gif?1324994303" title="男" /></li>
              <li>来自: 杭州</li>
              <li><img src='/images/status/offline.gif'/></li>
              
            </ul>
          </div>
          <div id="user_visits" class="clearfix">
            <h5>最近访客 <span style='font-weight:normal;font-size:12px;padding-left:30px;'><a href="/blog/user_visits">更多访客&gt;&gt;</a></span></h5>
            
              <div class="user_visit">
                <div class="logo"><a href='http://dylinshi126.iteye.com' target='_blank'><img alt="dylinshi126的博客" class="logo" src="http://www.iteye.com/images/user-logo-thumb.gif?1324994303" title="dylinshi126的博客: " /></a></div>
                <div class="left"><a href='http://dylinshi126.iteye.com' target='_blank' title='dylinshi126'>dylinshi126</a></div>
              </div>
            
              <div class="user_visit">
                <div class="logo"><a href='http://huidu333.iteye.com' target='_blank'><img alt="阿图是会飞的猪的博客" class="logo" src="http://www.iteye.com/upload/logo/user/771027/217a6cb5-0dff-35de-9b03-979edcb2c47d-thumb.jpg?1353941751" title="阿图是会飞的猪的博客: " /></a></div>
                <div class="left"><a href='http://huidu333.iteye.com' target='_blank' title='阿图是会飞的猪'>阿图是会飞的猪</a></div>
              </div>
            
              <div class="user_visit">
                <div class="logo"><a href='http://eyefresh.iteye.com' target='_blank'><img alt="eyefresh的博客" class="logo" src="http://www.iteye.com/images/user-logo-thumb.gif?1324994303" title="eyefresh的博客: " /></a></div>
                <div class="left"><a href='http://eyefresh.iteye.com' target='_blank' title='eyefresh'>eyefresh</a></div>
              </div>
            
              <div class="user_visit">
                <div class="logo"><a href='http://zhangbowu.iteye.com' target='_blank'><img alt="zhangbowu的博客" class="logo" src="http://www.iteye.com/images/user-logo-thumb.gif?1324994303" title="zhangbowu的博客: zhangbowu" /></a></div>
                <div class="left"><a href='http://zhangbowu.iteye.com' target='_blank' title='zhangbowu'>zhangbowu</a></div>
              </div>
            
          </div>

          

                      <div id="blog_menu">
              <h5>文章分类</h5>
              <ul>
                <li><a href="/">全部博客 (13)</a></li>
                
                  <li><a href="/category/94922">Java (4)</a></li>
                
                  <li><a href="/category/161605">Linux (2)</a></li>
                
                  <li><a href="/category/94923">数据库 (1)</a></li>
                
                  <li><a href="/category/94924">设计模式 (0)</a></li>
                
                  <li><a href="/category/222980">Web前端 (5)</a></li>
                
                  <li><a href="/category/222982">HTML5 (2)</a></li>
                
                  <li class='selected'><a href="/category/222986">移动开发 (3)</a></li>
                
                  <li><a href="/category/222988">图形图像 (4)</a></li>
                
                  <li><a href="/category/161286">其他 (0)</a></li>
                
              </ul>
            </div>
            <div id='month_blogs'>
              <h5>社区版块</h5>
              <ul>
                <li><a href="/blog/news">我的资讯</a> (0)</li>
                <li>
                  <a href="/blog/post">我的论坛</a> (0)
                </li>
                <li><a href="/blog/answered_problems">我的问答</a> (0)</li>
              </ul>
            </div>
            <div id="month_blogs">
              <h5>存档分类</h5>
              <ul>
                
                  <li><a href="/blog/monthblog/2012-12">2012-12</a> (1)</li>
                
                  <li><a href="/blog/monthblog/2012-10">2012-10</a> (1)</li>
                
                  <li><a href="/blog/monthblog/2012-09">2012-09</a> (1)</li>
                
                <li><a href="/blog/monthblog_more">更多存档...</a></li>
              </ul>
            </div>
            
            

            <div id="guest_books">
              <h5>最新评论</h5>
              <ul>
                
                <li>
                  <a href='http://904312072.iteye.com' target='_blank' title='淅沥枫'>淅沥枫</a>： 
                  不错哟.....<br />
                  <a href="/blog/1100678#bc2292507">二维码 编码原理简介</a>
                </li>
                
                <li>
                  <a href='http://zhouwei849712382.iteye.com' target='_blank' title='zhouwei849712382'>zhouwei849712382</a>： 
                     <br />
                  <a href="/blog/1100678#bc2291313">二维码 编码原理简介</a>
                </li>
                
                <li>
                  <a href='http://hillshills.iteye.com' target='_blank' title='hillshills'>hillshills</a>： 
                  了解了！<br />
                  <a href="/blog/1100678#bc2256021">二维码 编码原理简介</a>
                </li>
                
              </ul>
            </div>

            <div class="local_bottom"></div>
          
        </div>
      </div>

      <div id="footer" class="clearfix">
        <div id="copyright">
          <hr/>
          声明：ITeye文章版权属于作者，受法律保护。没有作者书面许可不得转载。若作者同意转载，必须以超链接形式标明文章原始出处和作者。<br />
          &copy; 2003-2012 ITeye.com.   All rights reserved.  [ 京ICP证110151号  京公网安备110105010620 ]
        </div>
      </div>
    </div>
    <script type="text/javascript">
  document.write("<img src='http://stat.iteye.com/?url="+ encodeURIComponent(document.location.href) + "&referrer=" + encodeURIComponent(document.referrer) + "&user_id=' width='0' height='0' />");
</script>

    
    
  </body>
</html>
